using System;
using System.Collections.Generic;
using System.Text;
using MbUnit.Framework;

namespace Tests
{
    [TestsOn(typeof(SqlBlocks.Drivers.MockDatabase))]
    public class MockDatabase : Migrations
    {
        public MockDatabase()
            : base()
        {
            driver.MockEvent += new SqlBlocks.Drivers.MockDatabaseEvent(driver_MockEvent);
        }

        void driver_MockEvent(string message)
        {
            Console.WriteLine(message);
        }

        SqlBlocks.Drivers.MockDatabase driver = new SqlBlocks.Drivers.MockDatabase();
        protected override SqlBlocks.Drivers.IDatabaseDriver Driver
        {
            get { return driver; }
        }

        protected override string ConnectionString
        {
            get { return "ROFL"; }
        }

        public override void SetupDriver()
        {
            Console.WriteLine("Mock driver... engage!");
        }

        public override void TeardownDriver()
        {
            Console.WriteLine("Mock driver... halt!");
        }
        
        /// <summary>
        /// Have the override this because the MockDriver never fails
        /// </summary>
        public override void FailMigration()
        {
            throw new SqlBlocks.MigrationFailedException("Gah, stupid MockDriver", null);
        }
    }
}
